package com.lhframework.sms.controller;

import com.lhframework.sms.api.SmsApi;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lh.base.support.model.AjaxResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lh on 2017/7/10.
 */
@RestController
@RequestMapping("/sms")
public class ShortMessageController {

    @Autowired
    private SmsApi smsApi;

    @ApiOperation(value = "登录验证码", notes = "供用户登录获取验证码时使用")
    @ApiImplicitParam(name = "phone", value = "手机号", required = true, paramType = "path", dataType = "string")
    @RequestMapping(value = "/loginVerifyCode/{phone}", method = RequestMethod.POST)
    public AjaxResponse loginVerifyCode(@PathVariable String phone) {
        String verifyCode = smsApi.loginVerifyCodeMsg(phone);
        return AjaxResponse.ok().data(verifyCode);
    }
}
